#pragma once

#include <algorithm>
#include <deque>


#ifdef _WIN32

#define CHAR_PATH_SEPARATOR _T('\\')
#define STRING_PATH_SEPARATOR _T("\\")


#else

#define CHAR_PATH_SEPARATOR _T('/')
#define STRING_PATH_SEPARATOR _T("/")

#endif

typedef std::deque<CStringA> CStringAVector;
typedef std::deque<CString> CStringVector;


BOOL ChangeSubWindowSizeX(HWND hwnd, int xSize, HWND hParent);

bool IsDialogSizeOK(int xSize, int ySize);

inline HRESULT StringToBstr(LPCOLESTR src, BSTR *bstr)
{
  *bstr = ::SysAllocString(src);
  return (*bstr != 0) ? S_OK : E_OUTOFMEMORY;
}

class CMenuItemString : public CMenuItemInfo
{
private:
	static const UINT kMaxSize = 512 + 1;
	TCHAR buffer[kMaxSize];
public:
	void SetBuffer()
	{
		::ZeroMemory(buffer, kMaxSize);
		dwTypeData = buffer;
		cch = kMaxSize - 1;
	}
	void SetValue(CString value) 
	{
		dwTypeData = (LPTSTR)(LPCTSTR)value;
		cch = value.GetLength();
	}
	CMenuItemString () : CMenuItemInfo() 
	{
		fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
		fType = MFT_STRING;
		SetBuffer();
	}
};